package com.ruoyi.system.service.impl;

import com.ruoyi.common.annotation.DataScope;
import com.ruoyi.common.utils.Common;
import com.ruoyi.common.utils.ExcelUtil;
import com.ruoyi.common.utils.ReadExcelUtil;
import com.ruoyi.system.domain.ExcelLog;
import com.ruoyi.system.domain.Phone;
import com.ruoyi.system.domain.PhoneLabel;
import com.ruoyi.system.domain.Phones;
import com.ruoyi.system.mapper.ExcelLogMapper;
import com.ruoyi.system.mapper.PhoneLabelMapper;
import com.ruoyi.system.mapper.PhoneMapper;
import com.ruoyi.system.service.ExcelLogService;
import com.ruoyi.system.service.PhoneService;
import org.apache.commons.lang3.StringUtils;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.io.InputStream;
import java.text.SimpleDateFormat;
import java.util.ArrayList;
import java.util.List;

/**
 * 微信 业务层处理
 * 
 * @author admin
 */
@Service
public class ExcelLogServiceImpl implements ExcelLogService {

	private static final Logger LOGGER = LoggerFactory.getLogger(ExcelLogServiceImpl.class);

	@Autowired
	private ExcelLogMapper excelLogMapper;


	public List<ExcelLog> selectExcelLogData(ExcelLog excelLog) {
		List<ExcelLog> logs = excelLogMapper.selectExcelLogData(excelLog);
		for(ExcelLog log : logs){
			log.setPrefixExcelName(ExcelUtil.allFileName(log.getExcelName()));
		}
		return logs;
	}


	@Override
	public int insertExcelLog(ExcelLog excelLog){
		return excelLogMapper.insertExcelLog(excelLog);
	}

	@Override
	public int insertExcelLog(String excelName,double excelSize, int excelNum){
		ExcelLog excelLog = new ExcelLog();
		excelLog.setExcelName(excelName);
		excelLog.setExcelSize(excelSize);
		excelLog.setExcelNum(excelNum);
		return excelLogMapper.insertExcelLog(excelLog);
	}


	@Override
	public ExcelLog getEntityById(Long id){
		ExcelLog el = new ExcelLog();
		el.setId(id);
		return excelLogMapper.getEntity(el);
	}


}
